package com.cjm.one.security.custom;

import com.cjm.one.model.system.entity.SysUserInfo;
import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.AllArgsConstructor;
import org.springframework.security.core.userdetails.User;

import java.util.ArrayList;
public class CustomUser extends User implements java.io.Serializable {

    public CustomUser() {
        super("", "", new ArrayList<>());
        // 默认构造方法，可以初始化一些默认值或保持为空
    }
    /**
     * 我们自己的用户实体对象，要调取用户信息时直接获取这个实体对象。（这里我就不写get/set方法了）
     */
    private SysUserInfo sysUser;

    public CustomUser(SysUserInfo sysUser) {
        super(sysUser.getUsername(), sysUser.getPassword(), new ArrayList<>());
        this.sysUser = sysUser;
    }

    public SysUserInfo getSysUser() {
        return sysUser;
    }

    public void setSysUser(SysUserInfo sysUser) {
        this.sysUser = sysUser;
    }

}

